var userConfig={
    init:function(){
        var self=this;
        self.shadeDiv = $("#shade-div");
        self.bindEvents();

    },
    bindEvents:function(){
        var self=this;

        $("#editButton").click(function(){
        	userConfig.ajaxPOST(ctx+"/config/user_config!update.xhtml",$("#editForm").serialize(),function(data){
        		alert(data.message);
        		location.reload(true);   
        	});
        });
        
        $("#config121").click(function(){
             $(".editItem").show();
        });
        
        $("#config122").click(function(){
             $(".editItem").hide();
        });
        
    },

    ajaxGET:function (url, data, fn,beforeSendFn) {
        var beforeSendFn = beforeSendFn || function(){};
        $.ajax({type:"GET", dataType:'json', context:this, url:url, data:data, success:fn, beforeSend:beforeSendFn});
    },
    ajaxPOST:function (url, data, fn,beforeSendFn) {
        var beforeSendFn = beforeSendFn || function(){};
        $.ajax({type:"POST", dataType:'json', context:this, url:url, data:data, success:fn, beforeSend:beforeSendFn});
    }

}
$(function(){
	userConfig.init();
})